<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>
   	</f:metadata>
   
   	<ui:define name="content">
   
		<h:form id="editForm" enctype="multipart/form-data">         
			<p:panel id="panel" header="发布流程" style="margin-bottom:10px;">
		       	<p:messages id="messages" closable="true">
		       		<p:autoUpdate />
		       	</p:messages>		
		       	
		       	<h:panelGrid columns="2">
		       		<p:outputLabel for="processKey" value="processKey"></p:outputLabel>
		       		<p:inputText id="processKey" value="#{processDeployer.processKey}"></p:inputText>
		       		
		       		<p:outputLabel for="processDefinationFile" value="流程定义文件"></p:outputLabel>
		       		<p:fileUpload
						id="processDefinationFile"
						required="true"
						mode="simple"
						skinSimple="true"
						label="流程定义文件"								
						value="#{processDeployer.uploadFile}"
						sizeLimit="512000"
						invalidSizeMessage="文件过大，最大512KB"
					></p:fileUpload>
		       	</h:panelGrid>
					
				<p:commandButton ajax="false" action="#{processDeployer.deploy()}" value="发布"></p:commandButton>			
			</p:panel>
			
			<p:panel header="已发布流程">
				<p:dataTable value="#{processDeployer.resultList}" var="_pd">
					<p:column headerText="ID">
						#{_pd.deploymentId}
					</p:column>
					<p:column headerText="key">
						#{_pd.key}
					</p:column>
					<p:column headerText="name">
						#{_pd.name}
					</p:column>
					<p:column headerText="操作"  rendered="false">
						<p:commandButton action="#{processDeployer.undeploy(_pd.deploymentId)}" value="取消发布"></p:commandButton>
					</p:column>
				</p:dataTable>
			</p:panel>
		</h:form>
      
   	</ui:define>
</ui:composition>
 